/*
 * @filename DefaultCurrentUserService.java
 * @author barry
 * @version 0.0.1
 * @date 2020年1月6日
 */
package com.bnzj.cloud.security;

import com.bnzj.cloud.business.core.service.SysUserService;
import com.bnzj.core.rest.CurrentUserService;
import com.bnzj.core.rest.UserInfo;
import com.bnzj.core.web.security.util.SecurityUtils;

import javax.annotation.Resource;

/**
 * @author barry
 * @date 2020-01-06
 */
//@Component
//@ConditionalOnMissingBean(CurrentUserService.class)
public class DefaultCurrentUserService implements CurrentUserService {

    public DefaultCurrentUserService(){
        System.out.println("test");
    }
    @Resource
    private SysUserService sysUserService;
    
    @Override
    public String getAccount() {
        return SecurityUtils.getCurrentUser().getUsername();
    }

    @Override
    public UserInfo getUserInfo() {
        return sysUserService.findByAccount(getAccount());
    }
}
